#!/bin/sh
path="./" #默认路径
JAR="cloud-disk.jar" #jar包名称
#JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseParallelGC" #jvm配置
JAVA_OPTS=""
if [ -n "$1" ]; then
    path=$1"/"
fi
if [ -n "$2" ]; then
    JAR="$2"
fi
PIDFILE=$path"service.pid"
ADDRESS=$path""$JAR
if [ -f $PIDFILE ]; then
    echo "Service is already start ..."
else
    if [ -f $ADDRESS ]; then
        nohup java $JAVA_OPTS -jar $ADDRESS --spring.config.location=$path >/dev/null 2>&1 &
        printf '%d' $! > $PIDFILE
        echo "Service  start ..."
    else
        echo "jar non-existent"
    fi
fi

